
package Admin;

public class MainFrame extends javax.swing.JFrame {

    BatchFrame batch;
    CourseFrame course;
    FinanceFrame finance;
    StudentFrame student;
    TeacherFrame teacher;
    AdminFrame admin;
    SubjectFrame subject;
    MarkFrame mark;
            
    public MainFrame() {
        initComponents();
        
        batch = new BatchFrame();
        course = new CourseFrame();
        finance = new FinanceFrame();
        student = new StudentFrame();
        teacher = new TeacherFrame();
        admin = new AdminFrame();
        subject = new SubjectFrame();
        mark = new MarkFrame();
        
        this.myDesktop.add(batch);
        batch.setVisible(true);
        batch.setSize(1000, 600);
        this.myDesktop.removeAll();
        
        this.myDesktop.add(course);
        course.setVisible(true);
        course.setSize(1000, 600);
        this.myDesktop.removeAll();
        
        this.myDesktop.add(finance);
        finance.setVisible(true);
        finance.setSize(1000, 600);
        this.myDesktop.removeAll();
        
        this.myDesktop.add(student);
        student.setVisible(true);
        student.setSize(1000, 600);
        this.myDesktop.removeAll();
        
        this.myDesktop.add(teacher);
        teacher.setVisible(true);
        teacher.setSize(1000, 600);
        this.myDesktop.removeAll();
        
        this.myDesktop.add(admin);
        admin.setVisible(true);
        admin.setSize(1000, 600);
        this.myDesktop.removeAll();
        
        this.myDesktop.add(subject);
        subject.setVisible(true);
        subject.setSize(1000, 600);
        this.myDesktop.removeAll();
        
        this.myDesktop.add(mark);
        mark.setVisible(true);
        mark.setSize(1000, 600);
        this.myDesktop.removeAll();
        
        this.myDesktop.add(student);
        student.setVisible(true);
        student.setSize(1000, 600);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        myDesktop = new javax.swing.JDesktopPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        mnuExit = new javax.swing.JMenuItem();
        jMenu2 = new javax.swing.JMenu();
        menuBatch = new javax.swing.JMenuItem();
        jMenu3 = new javax.swing.JMenu();
        menuCourse = new javax.swing.JMenuItem();
        jMenu4 = new javax.swing.JMenu();
        menuFinance = new javax.swing.JMenuItem();
        jMenu5 = new javax.swing.JMenu();
        menuMark = new javax.swing.JMenuItem();
        jMenu6 = new javax.swing.JMenu();
        menuSubject = new javax.swing.JMenuItem();
        jMenu7 = new javax.swing.JMenu();
        menuAdmin = new javax.swing.JMenuItem();
        menuTeacher = new javax.swing.JMenuItem();
        menuStudent = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jMenu1.setText("File");

        mnuExit.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_X, java.awt.event.InputEvent.ALT_MASK));
        mnuExit.setText("Exit");
        mnuExit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                mnuExitActionPerformed(evt);
            }
        });
        jMenu1.add(mnuExit);

        jMenuBar1.add(jMenu1);

        jMenu2.setText("Batch");

        menuBatch.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_B, java.awt.event.InputEvent.ALT_MASK));
        menuBatch.setText("Batch Manage");
        menuBatch.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuBatchActionPerformed(evt);
            }
        });
        jMenu2.add(menuBatch);

        jMenuBar1.add(jMenu2);

        jMenu3.setText("Course");

        menuCourse.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_C, java.awt.event.InputEvent.ALT_MASK));
        menuCourse.setText("Course Manage");
        menuCourse.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuCourseActionPerformed(evt);
            }
        });
        jMenu3.add(menuCourse);

        jMenuBar1.add(jMenu3);

        jMenu4.setText("Finance");

        menuFinance.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_F, java.awt.event.InputEvent.ALT_MASK));
        menuFinance.setText("Finance Manager");
        menuFinance.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuFinanceActionPerformed(evt);
            }
        });
        jMenu4.add(menuFinance);

        jMenuBar1.add(jMenu4);

        jMenu5.setText("Mark");

        menuMark.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_M, java.awt.event.InputEvent.ALT_MASK));
        menuMark.setText("Mark Manager");
        menuMark.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuMarkActionPerformed(evt);
            }
        });
        jMenu5.add(menuMark);

        jMenuBar1.add(jMenu5);

        jMenu6.setText("Subject");

        menuSubject.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_S, java.awt.event.InputEvent.ALT_MASK));
        menuSubject.setText("Subject Manager");
        menuSubject.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuSubjectActionPerformed(evt);
            }
        });
        jMenu6.add(menuSubject);

        jMenuBar1.add(jMenu6);

        jMenu7.setText("User");

        menuAdmin.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_A, java.awt.event.InputEvent.ALT_MASK));
        menuAdmin.setText("Admin Manager");
        menuAdmin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuAdminActionPerformed(evt);
            }
        });
        jMenu7.add(menuAdmin);

        menuTeacher.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, java.awt.event.InputEvent.ALT_MASK));
        menuTeacher.setText("Teacher Manager");
        menuTeacher.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuTeacherActionPerformed(evt);
            }
        });
        jMenu7.add(menuTeacher);

        menuStudent.setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_D, java.awt.event.InputEvent.ALT_MASK));
        menuStudent.setText("Student Manager");
        menuStudent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuStudentActionPerformed(evt);
            }
        });
        jMenu7.add(menuStudent);

        jMenuBar1.add(jMenu7);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(myDesktop, javax.swing.GroupLayout.DEFAULT_SIZE, 1000, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(myDesktop, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void mnuExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_mnuExitActionPerformed
        // TODO add your handling code here:
        System.exit(0);

    }//GEN-LAST:event_mnuExitActionPerformed

    private void menuBatchActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuBatchActionPerformed
        this.myDesktop.removeAll();
        this.myDesktop.add(batch);
        batch.setVisible(true);
        batch.setSize(1000, 600);
    }//GEN-LAST:event_menuBatchActionPerformed

    private void menuCourseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuCourseActionPerformed
        this.myDesktop.removeAll();
        this.myDesktop.add(course);
        course.setVisible(true);
        course.setSize(1000, 600);
    }//GEN-LAST:event_menuCourseActionPerformed

    private void menuFinanceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuFinanceActionPerformed
        this.myDesktop.removeAll();
        this.myDesktop.add(finance);
        finance.setVisible(true);
        finance.setSize(1000, 600);
    }//GEN-LAST:event_menuFinanceActionPerformed

    private void menuMarkActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuMarkActionPerformed
        this.myDesktop.removeAll();
        this.myDesktop.add(mark);
        mark.setVisible(true);
        mark.setSize(1000, 600);
    }//GEN-LAST:event_menuMarkActionPerformed

    private void menuTeacherActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuTeacherActionPerformed
        this.myDesktop.removeAll();
        this.myDesktop.add(teacher);
        teacher.setVisible(true);
        teacher.setSize(1000, 600);
    }//GEN-LAST:event_menuTeacherActionPerformed

    private void menuAdminActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuAdminActionPerformed
        this.myDesktop.removeAll();
        this.myDesktop.add(admin);
        admin.setVisible(true);
        admin.setSize(1000, 600);
    }//GEN-LAST:event_menuAdminActionPerformed

    private void menuStudentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuStudentActionPerformed
        this.myDesktop.removeAll();
        this.myDesktop.add(student);
        student.setVisible(true);
        student.setSize(1000, 600);
    }//GEN-LAST:event_menuStudentActionPerformed

    private void menuSubjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuSubjectActionPerformed
        this.myDesktop.removeAll();
        this.myDesktop.add(subject);
        subject.setVisible(true);
        subject.setSize(1000, 600);
    }//GEN-LAST:event_menuSubjectActionPerformed

    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JMenu jMenu7;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem menuAdmin;
    private javax.swing.JMenuItem menuBatch;
    private javax.swing.JMenuItem menuCourse;
    private javax.swing.JMenuItem menuFinance;
    private javax.swing.JMenuItem menuMark;
    private javax.swing.JMenuItem menuStudent;
    private javax.swing.JMenuItem menuSubject;
    private javax.swing.JMenuItem menuTeacher;
    private javax.swing.JMenuItem mnuExit;
    private javax.swing.JDesktopPane myDesktop;
    // End of variables declaration//GEN-END:variables
}
